#ifndef RKVECTOR_H
#define RKVECTOR_H

typedef struct RkVector_t
{
  int numelem;
  double * elem;
} RkVector_t;

RkVector_t * RkVector_alloc(int numelem, ...);

void RkVector_free(RkVector_t * vec);

#define RkVector_SIZE(vec) ((vec)->numelem)

#define RkVector_ELEM(vec, idx) ((vec)->elem[(idx)])

double RkVector_sum(const RkVector_t * vec);

int RkVector_sample(const RkVector_t * vec); /* assuming sums to 1 */

void RkVector_normalize(RkVector_t * vec);

/* assuming that we have log of the weights */
void RkVector_lognormalize(RkVector_t * vec);

/* alternate construction API, doesn't require a free */
void RkVector_init(RkVector_t * vec, int numelem, double * elem);

void RkVector_print(const RkVector_t * vec);

#endif /* RKVECTOR_H */
